/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.eplatform.modules.sys.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import com.eplatform.common.config.Global;
import com.eplatform.common.service.BaseService;
import com.eplatform.common.utils.StringUtils;
import com.eplatform.common.utils.UserAgentUtils;

/**
 * 前台用户登录拦截
 * @author H
 * @version 2016
 */
public class JzInterceptor extends BaseService implements HandlerInterceptor {
	
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, 
			Object handler) throws Exception {
		Object user=request.getSession().getAttribute("front_user");
		if(user==null){
			response.setHeader("Content-type", "text/html;charset=UTF-8");  
			response.getWriter().write("登陆超时，请重新登陆。。。..");  
			return false;
		}
		return true;
	}

	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, 
			ModelAndView modelAndView) throws Exception {
	
	}

	@Override
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, 
			Object handler, Exception ex) throws Exception {
		
	}

}
